Changing build-time env variables to run-time only #312
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes [CAL-2635] by changing build-time environment variables to run-time.
Type of change
How should this be tested?
Scenario 1: Verify Image Build and Container Run
Build the image with (here you can see the logs):
docker build --build-arg DATABASE_URL="postgresql://postgres:@host.docker.internal:5432/calendso" -t calcom-image-test .
Run a container using the image with runtime variables:
docker run \ -e NEXTAUTH_SECRET="your_secret" \ -e DA TABASE_URL="your_database_url" \ -e CALENDSO_ENCRYPTION_KEY="your_key" \ -e NEXT_PUBLIC_WEBAPP_URL="http://localhost:3000" calcom-image-test
Expected Outcome: The container should start successfully with the provided variables. Test with invalid data to verify failure at runtime.
Scenario 2: Docker Compose
docker compose up -d
Disclaimer
At this point Build arguments cannot be removed as there are checks in the background for the existence of these variables.
While this makes sense when setting those variables build-time, when requiring the variables to be set only run-time, these checks might be redundant.